#include <cstdio>
#include <memory.h>

int a[ 24 * 3600 + 1 ], b[ 24 * 3600 + 1 ];

int main( )
{
    int n, i, t1, t2, ans, t;
    while ( scanf("%d", &n) && n )
    {
        t = ans = 0;
        memset( a, 0, sizeof( a ) );
        memset( b, 0, sizeof( b ) );
        for ( i = 0; i < n; i++ )
        {
            scanf("%d%d", &t1, &t2);
            a[ t1 ]++; b[ t2 ]++;
        }
        for ( i = 0; i <= 24 * 3600; i++ )
        {
            t += a[ i ];
            if ( ans < t ) ans = t;
            t -= b[ i ];
        }
        printf("%d\n", ans);
    }
    return 0;
}
